
#include<bits/stdc++.h>
using namespace std;
int a[5][5] = { {13,11,10,4,7},{13,10,10,8,5},{5,9,7,7,4},{15,12,10,11,5},{10,11,8,8,4} };
bool b[5] = { 0 };
int sum = 0, n = 0;
int name1[5], name2[5];
int c1[5] = { 0 };
void print()
{
	int m,  t;
	m = 0;
	for (t = 0; t <= 4; t++) {
		m = c1[t] + m;
	}

	if (m > n) {
		n = m;
		for (t = 0; t <= 4; t++) {
			name2[t] = name1[t];
		}

	}
}
void dfs(int i)
{
	for (int j = 0; j <= 4; j++) {
		if ((!b[j])) {
			c1[i] = a[i][j];
			b[j] = 1;
			name1[i] = j;
			if (i == 4) print();
			else dfs(i + 1);
			b[j] = 0;
		}
	}
}
int main()
{
	dfs(0);
	cout << "A:" << "J" << name2[0] + 1 << endl;
	cout << "B:" << "J" << name2[1] + 1 << endl;
	cout << "C:" << "J" << name2[2] + 1 << endl;
	cout << "D:" << "J" << name2[3] + 1 << endl;
	cout << "E:" << "J" << name2[4] + 1 << endl;

	cout << "supply:" << n;
	return 0;
}
